export default class WorkerBuilder {
  constructor(private worker: () => void) {
    const code = worker.toString()
    const blob = new Blob([`(${code})()`], { type: 'application/javascript' })
    this.instance = new Worker(URL.createObjectURL(blob))
  }

  private instance: Worker

  public getWorker(): Worker {
    return this.instance
  }
}
